<?php include("database_inc.php"); ?>

<?php


$operators = array();
$agencies = array();
$taxonomies = array();
$unreachable = array();
$time = array();
$treated = array();
$contacted = array();
$assistance = array();
$needmet_descriptions = array();


    $result = null;
    mysql_connect ($db_conn_address, $db_conn_username, $db_conn_password) or die ('Error: ' . mysql_error());
    mysql_select_db($db_QA_database);

     //load needmet_descriptions
     $i_count = 1;
     $result = mysql_query("select NeedMet_Description, Reference_Number from NeedMet");
     while ($row = mysql_fetch_array($result)){
         $needmet_descriptions[$row['Reference_Number']] = $row['NeedMet_Description'];
     }     


     //load taxonomies
     $result = mysql_query("Select Taxonomy_Description, Reference_Number From Taxonomies");
     while ($row = mysql_fetch_array($result)){
         $taxonomies[$row['Reference_Number']] = $row['Taxonomy_Description'];
         //echo "ref#: ".$row['Reference_Number'].";taxonomy:".$row['Taxonomy_Description']."<BR>";
     }
     //echo count($taxonomies)." taxonomies loaded<BR>";



     //load assistance
     $result = mysql_query("Select Assistance_Description, Reference_Number From Assistance");
     while ($row = mysql_fetch_array($result)){
        $assistance[$row['Reference_Number']] = $row['Assistance_Description'];
        //echo "ref#: ".$row['Reference_Number'].";assistance:".$row['Assistance_Description']."<BR>";
     }
     //echo count($assistance)." assistance loaded<BR>";



     //load refer
     $result = mysql_query("Select Refer_Description, Reference_Number From Refer");
     while ($row = mysql_fetch_array($result)){
        $refer[$row['Reference_Number']] = $row['Refer_Description'];
        //echo "ref#: ".$row['Reference_Number'].";refer:".$row['Refer_Description']."<BR>";
     }
     //echo count($refer)." refer loaded<BR>";



?>

<html>
<HEAD>


    <style type="text/css">
	.suggestion_list
	{
	background: white;
	border: 1px solid;
	padding: 4px;
	}
	
	.suggestion_list ul
	{
	padding: 0;
	margin: 0;
	list-style-type: none;
	}
	
	.suggestion_list a
	{
	text-decoration: none;
	color: navy;
	}
	
	.suggestion_list .selected
	{
	background: navy;
	color: white;
	}
	
	.suggestion_list .selected a
	{
	color: white;
	}

	#autosuggest
	{
	display: none;
	}
    </style>


<script type="text/javascript" src="datepickercontrol/datepickercontrol.js"></script>
<script type="text/javascript" src="autosuggest_0.1/autosuggest.js"></script>
<script language="javascript"> 
<!--
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}


function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(client_number,"Alliance client number must be entered.")==false)
  {client_number.focus();return false;}
  if (validate_required(call_date,"Please select a date.")==false)
  {call_date.focus();return false;}
  if (validate_required(unreachable_taxonomy,"Please select a taxonomy.")==false)
  {unreachable_taxonomy.focus();return false;}
  if (need_was_met.value==0){
   if (validate_required(agency_assistance,"Please select a reason why help was not recieved.")==false)
   {agency_assistance.focus();return false;}
  }
  if (need_was_met.value==1){
   agency_assistance.value = null;
   alert("Do not select a reason 'Why Not' when caller received assistance.");
   {need_was_met.focus();return false;}
  }
  }
}

function myReset(myform){
	myform.reset();
}

//--> 
</script> 


<link type="text/css" rel="stylesheet" href="datepickercontrol/datepickercontrol.css"> 

</HEAD>
<body><BR><BR>
<div id="autosuggest"><ul></ul></div>

<DIV style="font-family:Arial;width=90%">

<TABLE border=0 padding=0 width=100%><TR width=100%><TD align=left><U><B>Call QA Record</B></U></TD><TD align=center><A HREF="notices.php" target=_Top>Notices</A></TD><TD align=right><A HREF="procedures.php" target=_Top>Procedures</A></TD></TR></TABLE>
<BR>
<form name="input_form" id="input_form" action="newsave.php" method="post" onsubmit="return validate_form(this)" >
<DIV id="Client" style="padding: 10px 50px 30px 5px;border:solid thin black">
<TABLE border=0>
<TR><TD>
Client Number: <input type="text" size=10 maxlength=9 name="client_number" /><BR>
</TD>
</TR>
</TABLE>
<BR>
<input type="hidden" id="DPC_TODAY_TEXT" value="today">
<input type="hidden" id="DPC_BUTTON_TITLE" value="Open calendar...">
<input type="hidden" id="DPC_MONTH_NAMES" value="['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']">
<input type="hidden" id="DPC_DAY_NAMES" value="['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']">
<input type="hidden" id="DPC_DEFAULT_FORMAT" value="YYYY-MM-DD">
<input type="hidden" id="DPC_SUBMIT_FORMAT" value="YYYY-MM-DD">
Original date of call: <input type="text" name="call_date" id="calldate" size="12" style="border-width:1px;" datepicker="true">
<BR><BR>
Taxonomy? (Pick Best Fit)<BR>
<SELECT name="unreachable_taxonomy" SIZE=10>
<?php
     $isfirst =0;
     foreach($taxonomies as $key => $value){
          if($isfirst==0){
              $isfirst++;
              echo "<Option Value=\"".$key."\">".$value."</OPTION>";
          }else{
                echo "<Option Value=\"".$key."\">".$value."</OPTION>";
          }
     }
?>
</SELECT>
<BR><BR>

Did they receive help from the 211 Agency Referral?<BR>
<select name="need_was_met" Size=1>
     <Option value="0">No</OPTION>
     <Option value="1" selected>Yes</OPTION>
</Select>
<BR><BR>
If not, why not?<BR>

<SELECT name="agency_assistance" id="agency_assistance" SIZE=<?php echo (count($assistance)-1); ?> >

<?php
     $isfirst=0;
     foreach($assistance as $key => $value){
	 if($value != "Yes"){
          if($isfirst==0){
              $isfirst++;
              echo "<Option Value=\"$key\">$value</OPTION>";
          }else{
	      $value=str_replace("(Explain)", "", $value);
              echo "<Option Value=\"".$key."\">$value</OPTION>";
    }   } }
?>
</SELECT>
<BR><BR>

Would they use 211 Again? <BR>
<select name="appropriate" Size=1>
     <Option value="0">No</OPTION>
     <Option value="1" selected>Yes</OPTION>
</Select>
<BR><BR>

Would they recommend 211 to others? <BR>
<select name="refer" Size=1>
<?php
     $isfirst=0;
     foreach($refer as $key => $value){
	  if ($value != "Maybe"){
	          if($isfirst==0){
        	      $isfirst++;
	              echo "<Option selected Value=\"".$key."\">".$value."</OPTION>";
        	  }else{
	              echo "<Option Value=\"".$key."\">".$value."</OPTION>";
        	  }
	  }
     }
?>
</Select>
<BR><BR>

</DIV>
</DIV>


<input type="button" value="Clear Form and Start Over" onClick="javascript:myReset(document.input_form);" />
<input type="submit" value="Submit" />
</form>
<BR>
<A href="http://211qa.uservoice.com/pages/34599-general?lang=en&utm_campaign=Widgets&utm_content=tab-widget&utm_medium=widget&utm_source=211qa.uservoice.com" target="_Top">click here to visit the feedback forum where you can provide bug reports, enhancement requests and support questions!</A>
</DIV>
</body>
</html>